package com.butterfly.mvc.servlet;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by DouDou on 2016/9/19.
 */
public class MvcBean {

    public MvcBean(){

    }

    private String name;
    private String path;
    private String formType;
    private String actionType;
    private String method;
    private Map<String,String> forwards = new HashMap<String, String>();

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getFormType() {
        return formType;
    }

    public void setFormType(String formType) {
        this.formType = formType;
    }

    public String getActionType() {
        return actionType;
    }

    public void setActionType(String actionType) {
        this.actionType = actionType;
    }

    public String getMethod() {
        return method;
    }

    public void setMethod(String method) {
        this.method = method;
    }

    public Map<String, String> getForwards() {
        return forwards;
    }

    public void setForwards(Map<String, String> forwards) {
        this.forwards = forwards;
    }

    @Override
    public String toString() {
        return "MvcBean{" +
                "name='" + name + '\'' +
                ", path='" + path + '\'' +
                ", formType='" + formType + '\'' +
                ", actionType='" + actionType + '\'' +
                ", method='" + method + '\'' +
                ", forwards=" + forwards +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        MvcBean mvcBean = (MvcBean) o;

        if (!name.equals(mvcBean.name)) return false;
        if (!path.equals(mvcBean.path)) return false;
        if (!formType.equals(mvcBean.formType)) return false;
        if (!actionType.equals(mvcBean.actionType)) return false;
        if (!method.equals(mvcBean.method)) return false;
        return forwards.equals(mvcBean.forwards);

    }

    @Override
    public int hashCode() {
        int result = name.hashCode();
        result = 31 * result + path.hashCode();
        result = 31 * result + formType.hashCode();
        result = 31 * result + actionType.hashCode();
        result = 31 * result + method.hashCode();
        result = 31 * result + forwards.hashCode();
        return result;
    }
}
